/*
#
#  Copyright 2011 Matthew Jannace
#
#  This file is part of RoboCode BlackHoleAgent
#
#  RoboCode BlackHoleAgent is free software: you can redistribute it and/or
#  modify it under the terms of the GNU General Public License as
#  published by the Free Software Foundation, either version 3 of the
#  License, or (at your option) any later version.
#
#  RoboCode BlackHoleAgent is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#  General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with RoboCode BlackHoleAgent. If not, see
#  <http://www.gnu.org/licenses/>.
#
 */
package com.jannaceltd.TeamBlackHoleBeer.Modules.Communication;

import com.jannaceltd.TeamBlackHoleBeer.BlackHole_Interface;
import com.jannaceltd.TeamBlackHoleBeer.Modules.HelperClasses.Enemy;
import com.jannaceltd.TeamBlackHoleBeer.Modules.HelperClasses.TeamMate;
import com.jannaceltd.TeamBlackHoleBeer.Modules.HelperClasses.VirtualBullets;
import java.io.Serializable;
import java.lang.annotation.Target;
import java.util.HashMap;

/**
 * Formated Message for Teammate Communication
 * @author Matthew Jannace <mjannace@gmail.com>
 * @version 1.0
 */
public class TeamMateMessage implements Serializable, BlackHole_Interface {

    private static final long serialVersionUID = 5890963822395906392L;
    /**
     * HashMap containing Enemies information
     */
    protected HashMap<String, Enemy> enemies = null;
    /**
     * HashMap containing Teammates information
     */
    protected HashMap<String, TeamMate> teamates = null;
    /**
     * HashMap containing Teammates Next Location information
     */
    protected HashMap<String, TeamMate> teamatesNextLocation = null;
    /**
     * HashMap containing (Active or In Flight) Friendly Fire information
     */
    protected HashMap<String, VirtualBullets> activeFriendlyFire = null;
    /**
     * HashMap containing (inActive or Inert) Friendly Fire information
     */
    protected HashMap<String, VirtualBullets> inActiveFriendlyFire = null;
    /**
     * String containing the Targets name
     */
    protected String Target = "";

    /**
     * Creates a New TeamMateMessage for broadcasting
     * @see Communication(BlackHole_Abstract Agent)
     */
    public TeamMateMessage() {
        enemies = new HashMap<String, Enemy>(1);
        teamates = new HashMap<String, TeamMate>(1);
        teamatesNextLocation = new HashMap<String, TeamMate>(1);
        activeFriendlyFire = new HashMap<String, VirtualBullets>(1);
        inActiveFriendlyFire = new HashMap<String, VirtualBullets>(1);
    }

    /**
     * Returns a Enemy HashMap
     * @return HashMap<String, Enemy>
     * @see TeamMateMessage()
     * @see Enemy
     */
    public HashMap<String, Enemy> getEnemies() {
        return this.enemies;
    }

    /**
     * Adds a enemy entry into the TeamMateMessage Enemies HashMap
     * @param key 
     * @param value 
     * @see TeamMateMessage()
     * @see Enemy
     */
    public void setEnemies(String key, Enemy value) {
        this.enemies.put(key, value);
    }

    /**
     * Returns an string name of the current enemy target
     * @return Target
     * @see TeamMateMessage()
     * @see Target
     */
    public String getTarget() {
        return Target;
    }

    /**
     * Sets the string name of the current enemy target
     * @param Target 
     * @see TeamMateMessage()
     * @see Target
     */
    public void setTarget(String Target) {
        this.Target = Target;
    }

    /**
     * Returns a TeamMate HashMap
     * @return HashMap<String, TeamMate>
     * @see TeamMateMessage()
     * @see TeamMate
     */
    public HashMap<String, TeamMate> getTeamates() {
        return this.teamates;
    }

    /**
     * Adds a TeamMate entry into the TeamMateMessage TeamMate HashMap
     * @param key
     * @param value
     * @see TeamMateMessage()
     * @see TeamMate
     */
    public void setTeamates(String key, TeamMate value) {
        this.teamates.put(key, value);
    }

    /**
     * Returns a TeamMatesNextLocation HashMap
     * @return HashMap<String, TeamMate>
     * @see TeamMateMessage()
     * @see TeamMate
     */
    public HashMap<String, TeamMate> getTeamatesNextLocation() {
        return this.teamatesNextLocation;
    }

    /**
     * Adds a TeamMate entry into the TeamMateMessage TeamMatesNextLocation HashMap
     * @param key
     * @param value
     * @see TeamMateMessage()
     * @see TeamMate
     */
    public void setTeamatesNextLocation(String key, TeamMate value) {
        this.teamatesNextLocation.put(key, value);
    }

    /**
     * Returns a FriendlyFire HashMap, the FriendlyFireState determines whether
     * to retrieve the active or inaction FriendlyFire
     * @param state
     * @return HashMap<String, VirtualBullets>
     * @see TeamMateMessage()
     * @see VirtualBullets
     */
    public HashMap<String, VirtualBullets> getFriendlyFire(FriendlyFireState state) {
        switch (state) {
            case INACTIVE:
                return this.inActiveFriendlyFire;

            case ACTIVE:
            default:
                return this.activeFriendlyFire;
        }
    }

    /**
     * Adds a VirtualBullet entry into the TeamMateMessage FriendlyFire HashMap,
     * the FriendlyFireState determines whether to add the VirtualBullet to the
     * active or inaction FriendlyFire HashMap
     * @param key 
     * @param value 
     * @param state 
     * @see TeamMateMessage()
     * @see TeamMate
     */
    public void setFriendlyFire(String key, VirtualBullets value, FriendlyFireState state) {
        switch (state) {
            case ACTIVE:
                this.activeFriendlyFire.put(key, value);
                break;
            case INACTIVE:
                this.inActiveFriendlyFire.put(key, value);
                break;
        }
    }
}
